import sys

from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton, QHBoxLayout, QVBoxLayout, QLabel, QWidget

class MainWindow(QMainWindow):
    def __init__(self):
        super().__init__()

        h = QHBoxLayout()
        v = QVBoxLayout()

        for n in range(10):
            button = QPushButton(str(n))
            button.clicked.connect(lambda checked, a=n: self.button_clicked(a))
            h.addWidget(button)

        self.label = QLabel("")
        v.addLayout(h)
        v.addWidget(self.label)

        w = QWidget()
        w.setLayout(v)
        self.setCentralWidget(w)

    def button_clicked(self, a):
        self.label.setText(str(a))

app = QApplication(sys.argv)
window = MainWindow()
window.show()
app.exec()




